<template>
    <div class="business-inquiries">
        <el-radio-group 
        class="radio-type-change"
        v-model="radio" 
        >
            <el-radio-button label="0">
                <span>基本信息</span> 
            </el-radio-button>
            
            <el-radio-button label="1">
                <span v-czc="['查企业-详情-基本信息', '导航' , '风险查询', 0 ,`checkEnterpriseInfo-btn-checkRisk`]">风险查询</span> 
            </el-radio-button>
        </el-radio-group>

        <div class="business-main">
            <base-info 
                v-show="radio == '0'" 
                :isHavingPower="isHavingPower" 
                :isLogin="isLogin"
                :surplusNum="surplusNum" 
                :company="company"
                @use="$emit('use')" 
                @afterBuy="$emit('afterBuy')" 
            ></base-info>

            <keep-alive>
                <riks-query 
                    v-if="radio == '1'" 
                    :isHavingPower="isHavingPower" 
                    :isLogin="isLogin"
                    :surplusNum="surplusNum" 
                    :company="company"
                    @use="$emit('use')" 
                    @afterBuy="$emit('afterBuy')" 
                ></riks-query>
            </keep-alive>

        </div>
    </div>
</template>

<script>
import baseInfo from './components/base-info.vue';
import RiksQuery from './components/riks-query.vue';
import { mapGetters, mapActions } from 'vuex';

export default {
    layout: 'client',
    mixins: [],
    components: {
        baseInfo,
        RiksQuery,
    },
    props: {
        isHavingPower: {
            type: Boolean,
            default: false,
        },
        surplusNum: {
            type: Number,
            default: 0,
        },
        company: {
            type: String,
            default: '',
        },
    },
    data() {
        return {
            radio: '0',
            isLogin:null,
        };
    },
    computed: {
        ...mapGetters({
            nickname: 'userinfo/getNickname',
            userInfo: 'userinfo/getData',
        }),
    },
    watch: {},
    methods: {
        // 判断是否登录
        checkLoginHandler() {
            this.$store.dispatch('userinfo/checkIsLoginNoDoing',{
                login: ()=>{
                    this.isLogin = true;
                },
                noLogin: () =>{
                    this.isLogin = false;
                }, 
            })

        },
    },
    mounted() {},
    created() {
        this.checkLoginHandler();
    },
};
</script>

<style lang="scss" scoped>
@import '@css/var.scss';
.business-inquiries {
    ::v-deep {
        .el-radio-button__inner{
            border-radius: 0px;
        }
    }

    .radio-type-change{
        ::v-deep{
            .el-radio-button__inner{
                padding: 8px 12px;
            }
        }
    }
}
</style>